
Page({

  /**
   * 页面的初始数据
   */
  data: {
    schema:[
      {
        label:'是否同时获取用户订阅消息的订阅状态，默认不获取。注意：withSubscriptions 只返回用户勾选过订阅面板中的“总是保持以上选择，不再询问”的订阅消息。',
        prop:'withSubscriptions',
        type:'switch'
      },
    ],
    formData:{
      withSubscriptions: false
    },
    title: '',
    result: '',
    remark: '',
    webUrl: '',
    apiName: '',
    showPrivacy: false
  },
  onLoad(options) {
    console.log('options', options)
    wx.setNavigationBarTitle({
      title: options.title,
    })
    
    this.setData({
      title: options.title,
      zh:options.zh,
      remark: options.remark,
      webUrl: options.webUrl
    })
  },
  getFormData(e) {
    console.log('formdata==', e.detail.formData);
    this.setData({
      formData: e.detail.formData
    })
  },
  openSetting() {
    wx.openSetting({
      withSubscriptions: this.data.formData.withSubscriptions,
      success: (res) => {
        this.setData({
          result: res
        })
      },
      fail: (res) => {
        this.setData({
          result: res
        })
      }
    })
  },
  getSetting() {
    wx.getSetting({
      withSubscriptions: this.data.formData.withSubscriptions,
      success: (res) => {
        this.setData({
          result: res
        })
      },
      fail: (res) => {
        this.setData({
          result: res
        })
      }
    })
  },
  onUnload() {
  }
})